﻿using Microsoft.VisualStudio.Shell;
using System;
using System.Windows.Forms;

namespace jTCodeGenerate
{
    public partial class SelectProjectItemForm : Form
    {
        public Action<TreeNode, Form> BtnOkClick;
        public SelectProjectItemForm()
        {
            InitializeComponent();
            ThreadHelper.ThrowIfNotOnUIThread();
            var items = MainCommandBase.Instance.InitProjectFolderItem();
            treeViewProjectItemControl1.BandDataSource(items);
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            var selectNode = treeViewProjectItemControl1.SelectedNode;
            if (selectNode == null)
            {
                MessageBox.Show("请选择要保存的路径！");
                return;
            }
            if (BtnOkClick != null)
                BtnOkClick.Invoke(selectNode, this);
        }

        private void btn_close_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
